export default {
    //授权接口
    auth: {
        login: function (telephone, password) {
            return {
                method: "post",
                url: "/getToken",
                data: { telephone, password },
                hasToken: false
            }
        },
        refresh(refresh_token) {
            return {
                method: "post",
                url: "/refreshToken",
                //# 请求头
                headers: {
                    Authorization: refresh_token
                },
                //# 是否需要携带token
                hasToken: false
            }
        }
    },
    member: {
        getMe() {
            return {
                method: "get",
                url: "/member/getMe",
            }
        },
        register() {
            return {
                method: "post",
                url: "/member/register",
                hasToken: false
            }
        }
    },
    banner: {
        getList() {
            return {
                method: "get",
                url: "/banner/getList",
                hasToken: false
            }
        },
    },
    good: {
        getPage(pagenum, pagesize) {
            return {
                method: 'post',
                url: '/good/getPage',
                params: { pagenum, pagesize },
                hasToken: false,
            }
        },
        getByID(id) {
            return {
                method: 'get',
                url: '/good/getByID/' + id,
                hasToken: false,
            }
        },
    },
    category: {
        getTree() {
            return {
                method: 'get',
                url: '/category/getTree',
                hasToken: false,
            }
        },
    },
    config: {
        getAll() {
            return {
                method: 'get',
                url: '/config/getAll',
                hasToken: false,
            }
        },
    },
    comment: {
        getPage(pagenum, pagesize) {
            return {
                method: 'post',
                url: '/comment/getPage',
                params: { pagenum, pagesize },
                hasToken: false,
            }
        },
    },
    collect: {
        insert(good_id, user_id) {
            return {
                method: 'post',
                url: '/collection/insert',
                data: { good_id, user_id },
            }
        },
        delete(id) {
            return {
                method: 'delete',
                url: '/collection/delete/' + id,
            }
        },
        getCollect(good_id, user_id) {
            return {
                method: 'get',
                url: '/collection/getCollect',
                params: {
                    good_id: good_id,
                    user_id: user_id
                }
            }
        }
    },
    cart: {
        insert() {
            return {
                method: 'post',
                url: '/cart/insert',
                hasToken: true
            }
        },
        getPage(pagenum, pagesize, data = {}) {
            return {
                method: 'post',
                url: '/cart/getPage',
                params: { pagenum, pagesize },
                data,
                hasToken: true
            }
        },
        getSearch() {
            return {
                method: 'post',
                url: '/cart/getSearch',
                hasToken: true
            }
        },
        delete(id) {
            return {
                method: 'delete',
                url: '/cart/delete/' + id,
                hasToken: true
            }
        },
        update(id, good_count) {
            return {
                method: 'put',
                url: '/cart/update/' + id,
                data: {
                    good_count
                },
                hasToken: true
            }
        },
    },
    address: {
        insert() {
            return {
                method: 'post',
                url: '/address/insert',
                hasToken: true
            }
        },
        delete(id) {
            return {
                method: 'delete',
                url: '/address/delete/' + id,
                hasToken: true
            }
        },
        update(id) {
            return {
                method: 'put',
                url: '/address/update/' + id,
                hasToken: true
            }
        },
        getPage(pagenum, pagesize) {
            return {
                method: 'post',
                url: '/address/getPage',
                params: { pagenum, pagesize },
                hasToken: true
            }
        },
        getByID(id) {
            return {
                method: 'get',
                url: '/address/getByID/'+id,
                hasToken: true
            }
        },
        getDefault() {
            return {
                method: 'get',
                url: '/address/getDefault',
                hasToken: true
            }
        },
    },
    store: {
        getList() {
            return {
                method: "get",
                url: "/store/getList",
                hasToken: true
            }
        },
    },
    order: {
        insert() {
            return {
                method: "post",
                url: "/order/insert",
                hasToken: true
            }
        },
        getPage(pagenum, pagesize) {
            return {
                method: 'post',
                url: '/order/getPage',
                params: { pagenum, pagesize },
                hasToken: true
            }
        },
    },
    aliPay: {
        pay() {
            return {
                method: "post",
                url: "/aliPay/pay",
                hasToken: true
            }
        },
    },
}